#pragma once

#include "../SGD Wrappers/SGD_GraphicsManager.h"
#include "../SGD Wrappers/SGD_Geometry.h"
#include "../SGD Wrappers/SGD_Handle.h"
#include <string>
using namespace std;

class Frame
{
public:
	Frame();
	virtual ~Frame();

	//Accessors
	float GetFrameTimer() { return frameTimer; }
	SGD::Rectangle GetRenderRect() { return renderRect; }
	SGD::Rectangle GetCollisionRect() { return collisionRect; }
	SGD::Point GetAnchorPoint() { return anchorPoint; }
	SGD::Rectangle GetActiveRect() {
		if (!facingleft)
			return activeRect;
		else if (facingleft && activeRect != SGD::Rectangle(0, 0, 0, 0))
		{
			SGD::Rectangle tempActRect = activeRect;//the new active rectangle
			tempActRect.right = collisionRect.left - (activeRect.left - collisionRect.right);
			tempActRect.left = tempActRect.right - activeRect.ComputeWidth();
			return tempActRect;
		}
		return SGD::Rectangle(0, 0, 0, 0);
	}
	SGD::Point GetWeaponOffset() {
		if (!facingleft)
			return weaponOffset;
		else if (facingleft)
		{
			SGD::Point tempOffset = weaponOffset;//the new weapon offset
			tempOffset.x = collisionRect.left - (weaponOffset.x - collisionRect.right);
			return tempOffset;
		}
		return SGD::Point(0, 0);
	}
	string GetTheEvent() { return theEvent; }
	float GetDuration() { return duration; }

	//Mutators
	void SetFrameTimer(float x) { frameTimer = x; }
	void SetRenderRect(SGD::Rectangle x) { renderRect = x; }
	void SetCollisionRect(SGD::Rectangle x) { collisionRect = x; }
	void SetAnchorPoint(SGD::Point x) { anchorPoint = x; }
	void SetActiveRect(SGD::Rectangle x) { activeRect = x; }
	void SetWeaponOffset(SGD::Point x) { weaponOffset = x; }
	void SetTheEvent(string x) { theEvent = x; }
	void SetDuration(float x) { duration = x; }

	void SetFacing(bool face) { facingleft = face; }

private:
	float frameTimer = 0;
	SGD::Rectangle renderRect;
	SGD::Rectangle collisionRect;
	SGD::Point anchorPoint;
	SGD::Point leftweaponOffset;
	SGD::Rectangle activeRect;
	SGD::Rectangle leftactiveRect;
	SGD::Point weaponOffset;
	string theEvent;
	float duration = 0.0f;

	bool facingleft = false;
};

